package com.item.read.util;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

public class CacheUtils {

    private static Map<Integer, List<String>> cacheUrlData = new LinkedHashMap<>(100){
        @Override
        protected boolean removeEldestEntry(Map.Entry<Integer, List<String>> eldest) {
            return this.size() > 100;
        }
    };

    public static List<String> get(Integer key){
        return cacheUrlData.get(key.intValue());
    }

    public static void add(Integer key,List<String> val){
        cacheUrlData.put(key,val);
    }

    public static void flushCache(){
        cacheUrlData.clear();
    }
}
